Homework 3

PHYS 580 - Computational Physics

Professor Molnar

</br>

Ethan Knox

https://www.github.com/ethank5149

ethank5149@gmail.com

</br> </br>

October 16, 2020

</center>


Imports

Settings

Load External Files

Problem 1

4.10 (p.113)

Calculate the precession of the perihelion of Mercury, following the approach described in this section.

Only consider the correction coming from general relativity (ignore other Solar System planets).

Problem 2

4.14 (p.118)

Simulate the orbits of Earth and Moon in the solar system by writing a program that accurately tracks the motions of both as they move about the Sun. Be careful about (1) the different time scales present in this problem, and (2) the correct initial velocities (ie., set the initial velocity of Moon taking into account the motion of Earth around which it rotates).

Also run your code for a hypothetical ”Moon” that has either the same mass as Earth (e.g., binary planets), or a rather elliptical orbit.

Problem 3

5.7 (p.143)

Write two programs to solve the capacitor problem of Figures 5.6 and 5.7, one using the Jacobi method and one using the SOR algorithm. For a fixed accuracy (as set by the convergence test) compare the number of iterations, $N_{\text{iter}}$, that each algorithm requires as a function of the number of grid elements, $L$. Show that for the Jacobi method $N_{\text{iter}}\sim L^2$, while with SOR $N_{\text{iter}}\sim L$.

Note that you can borrow most of the work from Lab 7, but now you have to also include the SOR algorithm in your comparisons.

Jacobi

SOR

Iterations vs. Grid Size

Problem 4

5.8 (p.147)

Extend our treatment of a point charge in a metal box to deal with the case in which the charge is located near one face of the box. Study how the equipotential contours are affected by the proximity of a grounded surface (the face of the box).

Problem 5

E.2 (p.510)

Calculate the period of a non-linear oscillator described by

$$\frac{d^2\theta}{dt^2}=-\sin\theta$$

by numerically integrating

$$\sqrt{8}\int_0^{\theta_m}\frac{d\theta}{\sqrt{\cos\theta-\cos\theta_m}}$$

for several values of the maximum angle $\theta_m$, using the trapezoidal rule, Simpson's rule, or the Romberg integration method.